function sum(n) {
  return n > 1 ? sum(n - 1) + 2 * n - 1 : 1;
  //   return n * n;
}

console.log(sum(123));
console.log(sum(5));
